package GUI_boekwerk;

import java.awt.event.*;
import javax.swing.*;

@SuppressWarnings("serial")
public class TekstvakEnKnopPaneel extends JPanel
{
	private JTextField tekstvak;
	private JButton knop, herstelKnop;
	
	public TekstvakEnKnopPaneel()
	{
		tekstvak = new JTextField(20);
		tekstvak.setText("voer het hier in");
		
		knop = new JButton("klik hier");
		knop.addActionListener( new KnopHandler());
		
		herstelKnop = new JButton("Reset");
		herstelKnop.addActionListener( new HerstelKnopHandler());
		
		add(tekstvak);
		add(knop);
		add(herstelKnop);
	}
	
	class KnopHandler implements ActionListener
	{
		public void actionPerformed( ActionEvent e)
		{
			tekstvak.setText("well done");
		}
	}
	class HerstelKnopHandler implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			tekstvak.setText("");
		}
	}
}
